const result= require('../util/result/result.js');



/* 防止post里空对象 */
let prevent=(req,res,next) => {

  // console.log('xxxxxxxxxxx')
    /* 如果前端出来的JSON数据为空对象 */
    if(req.method==='POST'){
     if(JSON.stringify(req.body)==='{}'){   
       res.send({"success":false,"code":"400","msg":"post请求，空对象，已阻止"})
     }else{
       next()
     }
    }else if(req.method==='GET'){
       next()
    }
}


module.exports=prevent

